class MemberCardsController < ApplicationController
  before_action :set_menu

  def index
    @submenu = :member_list
    @title = '会员管理'
    @tasks_grid = initialize_grid(MemberCard, per_page: 8, order: 'id', order_direction: 'desc')
  end

  def show
    @title = "会员管理/明细"
    @buttons.push :action => member_cards_path, :label => "返回"
    @member_card = MemberCard.find params[:id]
    if params.has_key? :recharge
      @member_card.recharge(params[:account], params[:coupon])
      redirect_to member_card_path
    end
  end

  private
  def set_menu
    @mainmenu = :customer
  end
end
